#ifndef COLISIONEDITOR_H
#define COLISIONEDITOR_H

#include <QWidget>
#include <QListWidgetItem>
#include <Shinygami/datatree.hpp>
#include "yamlstream.h"

namespace Ui {
    class ColisionEditor;
}

class ColisionEditor : public QWidget
{
    Q_OBJECT

    struct ColisionGroup
    {
	bool operator==(QString n) { return (name == n); }
	QString        name;
	QList<QString> colideWith;
    };

public:
    explicit ColisionEditor(QWidget *parent = 0);
    ~ColisionEditor();

    void Load(Data);
    void Save(YamlStream&);

signals:
    void GroupAdded(QString);
    void GroupDeleted(QString);

private slots:
    void AddGroup(void);
    void DelGroup(void);
    void GroupChanged(QString);
    void ColideWithChanged(QListWidgetItem*);

private:
    QString              GenerateMask(ColisionGroup group);

    Ui::ColisionEditor   *ui;
    QList<ColisionGroup> _groups;
};

#endif // COLISIONEDITOR_H
